﻿using System.Windows;
using System.Windows.Controls;

namespace XmlVisualizer.DiagramDesigner {
	/// <summary>
	/// Implements ItemsControl for ToolboxItems    
	/// </summary> 
	public class Toolbox : ItemsControl {
		#region Properties
		/// <summary>
		/// Gets or sets the ItemHeight and ItemWidth properties of
		/// the WrapPanel used for this Toolbox 
		/// </summary>
		public Size ItemSize {
			get { return itemSize; }
			set { itemSize = value; }
		}
		private Size itemSize = new Size(50, 50);
		#endregion		

		#region Override methods
		/// <summary>
		/// Creates or identifies the element that is used to display the given item.
		/// </summary>
		/// <returns>new ToolBoxItem</returns> 
		protected override DependencyObject GetContainerForItemOverride() {
			return new ToolboxItem();
		}

		/// <summary>
		/// Determines if the specified item is (or is eligible to be) its own container.
		/// </summary>
		/// <param name="item">item to check</param>
		/// <returns>true if item is ToolboxItem, false otherwise.</returns>
		protected override bool IsItemItsOwnContainerOverride(object item) {
			return (item is ToolboxItem);
		}
		#endregion		
	}
}
